package com.java.dao.Impl;

import com.java.dao.AddLine;
import com.java.entity.AirLine;
import com.java.util.C3P0Util;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class AddLineImpl implements AddLine {
    QueryRunner qr=new QueryRunner(C3P0Util.getDataSource());
    @Override
    public int addLineNo(AirLine airLine) throws SQLException {
        String sql="insert into f_airline values(?,?,?,?)";
        Object[] obj={airLine.getAirlineNo(),airLine.getOrigin(),airLine.getDestination(),airLine.getDistance()};
        return qr.update(sql,obj);
    }
}
